/* SPDX-License-Identifier: GPL-2.0 */
/*
 * Copyright (C) 2016-2019, LomboTech Co.Ltd.
 * Author: lomboswer <lomboswer@lombotech.com>
 *
 * lombo_util.h - lombo util head file
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 */

#ifndef _LOMBO_UTIL_H
#define _LOMBO_UTIL_H

#include <linux/ioctl.h>
#include <linux/types.h>


struct util_fd2phy {
	__u32 fd;
	long phy_addr;
};

struct util_sync {
	__u32 fd;
};

struct util_alloc_data {
	__u32 len;
	__u32 fd;
	long phy_addr;
};

struct util_virt_data {
	void *virt;
	unsigned int size;
};

#define LB_UTIL_MAGIC		'L'

#define LB_UTIL_FD2PHY		_IOWR(LB_UTIL_MAGIC, 0, \
				      struct util_fd2phy)

#define LB_UTIL_SYNC		_IOWR(LB_UTIL_MAGIC, 0, \
				      struct util_sync)

#define LB_UTIL_ALLOC		_IOWR(LB_UTIL_MAGIC, 1, \
				      struct util_alloc_data)

#define LB_UTIL_FLUSH_PART	_IOWR(LB_UTIL_MAGIC, 2, \
					struct util_virt_data)

#define LB_UTIL_FLUSH_ALL	_IOWR(LB_UTIL_MAGIC, 3, int)

#endif /* _LOMBO_UTIL_H */
